<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<style type="text/css">
  table th{
   text-align: left;
  }
  #dd1{
    width:30px;
    height:15px;
    float:left;
    background-color: red;
    margin-top: 5px;
  }
  #dd3{
  width:30px;
  height:20px;
  float: left;
  text-align: center;
  margin-top: 7px;
  }
  #dd2{
  width:30px;
  height:15px;
  float:left;
  background-color: green; 
  margin-top: 5px; }
  #dd4{
  width:30px;
  height:20px;
  float: left;
  text-align: center;
  margin-top: 7px;
  }
button{
   font-size: 12px;
   margin-left: -20px;
   width: 40px;
   height: 20px;
}
#cz{
   margin-left: -20px;
}

</style>
<script type="text/javascript">

  function tr(){
	  var arr = []
	             $("table input:checked").each(function () {
	             arr.push($(this).val());
	             })
  var to=$("#to").val();

	   for(i in arr){		   
   var color=$("#"+arr[i]+"").parent().parent().parent().css("color");
   var dept=$("#"+arr[i]+"").parent().parent().next().next().next().next().next().children().text();
if(to!=dept){
	alertMsg.warn("只能选择本部门的数据！");
    $("#"+arr[i]+"").attr("checked",false);
}else{if(color=="rgb(0, 128, 0)"){
	   alertMsg.warn("只能选择未审批的数据！");
           $("#"+arr[i]+"").attr("checked",false);
	   } 
   if(color=="rgb(255, 0, 0)"){
		   alertMsg.warn("只能选择未审批的数据！");
		   $("#"+arr[i]+"").attr("checked",false);
		   }
   if(color=="rgb(0,0,0)"){
			   $("tr").attr("rel",arr[i]);
			   $("tr").attr("target","sid_user");
			   }
	   }
	   }
  }
  function aa(){
  $("#to").val("");
  }
  function bb(){
  $("#from").val("");
  }
    
</script>

    <form id="pagerForm" method="post" action="<%=basePath%>allocatemanager/findmessage.do">
	<input type="hidden" name="pageNum" value="${requestScope.condition.pageNum}" />
	<input type="hidden" name="numPerPage" value="${requestScope.condition.numPerPage}"/>
	<input type="hidden" name="code" value="${requestScope.condition.code}"/>
	<input type="hidden" name="to_dept" value="${requestScope.condition.to_dept}"/>
	<input type="hidden" name="from_dept" value="${requestScope.condition.from_dept}"/>
	<input type="hidden" name="create_time" value="${requestScope.condition.create_time}"/>
	<input type="hidden" id="to" value="${requestScope.dept }"/>
    </form>

<div class="pageHeader" >
	<form onsubmit="return navTabSearch(this);" action="<%=basePath%>allocatemanager/findmessage.do" method="post">
	<div class="searchBar">
		<table class="searchContent">
			<tr>
			    <td>
			        调拨流水号：<input type="text" value="${requestScope.condition.code}" name="code"/>
			    </td>
			    <td>
				调拨时间：<input type="text" value="${requestScope.condition.create_time}" name="create_time" readonly="readonly" class="date" name="dateStart">	
				</td>
				<td>
				原部门：<input bringbackname="district.deptid"  type="hidden"/>			
				<input class="required" bringbackname="district.deptname" name="from_dept" id="from" type="text" value="${requestScope.condition.from_dept}" readonly/>
				</td>
				<td>
				<a id="cz" class="btnLook" href="<%=basePath%>dept/showtree.do" lookupGroup="district">查找带回</a>	
				</td>
				<td><button onclick="bb()" id="qk">清空</button></td>
				<td>
				目标部门：<input bringbackname="district1.deptid"  type="hidden"/>
				<input class="required" bringbackname="district1.deptname"  name="to_dept" type="text" value="${requestScope.condition.to_dept}" readonly/>
				</td>
				<td>
				<a id="cz"class="btnLook" href="<%=basePath%>dept/showtree.do" lookupGroup="district1">查找带回</a>
				</td>
				<td><button onclick="aa()" id="qk">清空</button></td>
				
			</tr>
		</table>
		<div class="subBar">
			<ul>
			<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button>
				</div></div></li>
			<li><a class="buttonActive" href="<%=basePath %>allocatemanager/findexcelmessage.do" target="dwzExport" targetType="navTab" title="确定要导出这些记录吗?"><span>导出</span></a></li>		
				<li><a class="buttonActive" href="<%=basePath %>allocatemanager/finddept.do" target="dialog" rel="sub"><span>调拨</span></a></li>
			<li><a class="buttonActive" href="<%=basePath %>allocatemanager/updatejs.do" target="selectedTodo" rel="abc" title="确定要接受吗?"><span>接受</span></a></li>
			<li><a class="buttonActive" href="<%=basePath %>allocatemanager/updateht.do" target="selectedTodo" rel="abc" title="确定要回退吗?"><span>回退</span></a></li>
			</ul>
		</div>
	</div>
	</form>


<div class="panelBar" id="ts">
<div id="dd1"></div><div id="dd3">回退</div>
<div id="dd2"></div><div id="dd4">确认</div>
	</div>
	<table class="table" width="100%" layoutH="138">
		<thead>
		<tr>
		<th width="2%"></th>
		<th width="2%"></th>
		<th width="5%">货品数量</th>
		<th width="7%">调拨时间</th>
		<th width="5%">操作员</th>
		<th width="5%">状态</th>
        <th width="8%">目标部门</th>
        <th width="10%">流水号</th>
        <th width="10%">原部门</th>
        <th width="10%">商品类型</th>
        </tr>
        </thead>
		<tbody>
		
			<c:forEach items="${requestScope.lsit}" var="s" varStatus="ff">
			<c:choose><c:when test="${s.status=='0'}">
			<tr>
             </c:when><c:when test="${s.status=='1'}">
             <tr style="color: green;">
			 </c:when><c:otherwise>
			 <tr style="color: red;">
			 </c:otherwise></c:choose>		
			 <td align="center">${ff.index+1 }</td>
             <td  align="center"><input type="checkbox" name="abc" value="${s.id }" id="${s.id }" onclick="tr()"/></td>
			 <td >${s.allocatenum }</td>
			 <td >${s.create_time }</td>
			 <td >${s.operator }</td>
             <c:choose><c:when test="${s.status=='0'}"><td  id="status">在途</td></c:when>
             <c:when test="${s.status=='1'}"><td id="status">确认</td></c:when>
             <c:otherwise><td id="status">回退</td></c:otherwise></c:choose>
             <td >${s.to_dept}</td>
			 <td >${s.code }</td>
			 <td >${s.from_dept }</td>
			 <td >${s.goodtype }</td>
			 </tr>
	</c:forEach>
		</tbody>
	</table>
	<!-- 用来绘制分页的界面 -->
	<div class="pageContent">
		<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="10">10</option>
				<option value="20">20</option>
				<option value="50">50</option>
			</select>
			<span>条，共${requestScope.condition.totalCount}条</span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${requestScope.condition.totalCount}" numPerPage="${requestScope.condition.numPerPage}" pageNumShown="5" currentPage="${requestScope.condition.pageNum}"></div>
	</div>
</div>
   </div>

 

